//
// AWS Manager - A free AWS console application demonstrating advanced concepts
// Copyright (C) 2008-2010 Sean O'Dell. All rights reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
//     http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//
/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package com.awsmanager.common;

import java.util.Map;

/**
 *
 * @author Sean ODell
 */
public class AWSCredential {

    private String awsAccountId = null;
    private String awsAccountNickName = null;
    private String awsAccessKey = null;
    private String awsSecretKey = null;
    private String awsS3Server = null;
    private String awsSDBdomain = null;
    private String awsReadAMIs = null;
    private String sshUser = null;

    public AWSCredential() {
    }

    public AWSCredential(Map awsCredentialInfo) {

        if (awsCredentialInfo.get("awsAccountId") != null) {
            this.awsAccountId =
                    (String) awsCredentialInfo.get("awsAccountId");
        }

        if (awsCredentialInfo.get("awsAccountNickName") != null) {
            this.awsAccountNickName =
                    (String) awsCredentialInfo.get("awsAccountNickName");
        }

        if (awsCredentialInfo.get("awsAccessKey") != null) {
            this.awsAccessKey =
                    (String) awsCredentialInfo.get("awsAccessKey");
        }

        if (awsCredentialInfo.get("awsSecretKey") != null) {
            this.awsSecretKey =
                    (String) awsCredentialInfo.get("awsSecretKey");
        }

        if (awsCredentialInfo.get("awsS3Server") != null) {
            this.awsS3Server =
                    (String) awsCredentialInfo.get("awsS3Server");
        }

        if (awsCredentialInfo.get("awsSDBdomain") != null) {
            this.awsSDBdomain =
                    (String) awsCredentialInfo.get("awsSDBdomain");
        }

        if (awsCredentialInfo.get("awsReadAMIs") != null) {
            this.awsReadAMIs =
                    (String) awsCredentialInfo.get("awsReadAMIs");
        }

        if (awsCredentialInfo.get("sshUser") != null) {
            this.sshUser =
                    (String) awsCredentialInfo.get("sshUser");
        }

    }

    public String getAwsAccessKey() {
        return awsAccessKey;
    }

    public void setAwsAccessKey(String awsAccessKey) {
        this.awsAccessKey = awsAccessKey;
    }

    public String getAwsAccountId() {
        return awsAccountId;
    }

    public void setAwsAccountId(String awsAccountId) {
        this.awsAccountId = awsAccountId;
    }

    public String getAwsAccountNickName() {
        return awsAccountNickName;
    }

    public void setAwsAccountNickName(String awsAccountNickName) {
        this.awsAccountNickName = awsAccountNickName;
    }

    public String getAwsReadAMIs() {
        return awsReadAMIs;
    }

    public void setAwsReadAMIs(String awsReadAMIs) {
        this.awsReadAMIs = awsReadAMIs;
    }

    public String getAwsSDBdomain() {
        return awsSDBdomain;
    }

    public void setAwsSDBdomain(String awsSDBdomain) {
        this.awsSDBdomain = awsSDBdomain;
    }

    public String getAwsSecretKey() {
        return awsSecretKey;
    }

    public void setAwsSecretKey(String awsSecretKey) {
        this.awsSecretKey = awsSecretKey;
    }

    public String getAwsS3Server() {
        return awsS3Server;
    }

    public void setAwsS3Server(String awsS3Server) {
        this.awsS3Server = awsS3Server;
    }

    public String getSshUser() {
        return sshUser;
    }

    public void setSshUser(String sshUser) {
        this.sshUser = sshUser;
    }

    @Override
    public String toString() {
        StringBuffer sb = new StringBuffer();
        sb.append("Credential Details - ");
        sb.append("awsAccessKey: " + getAwsAccessKey() + ", ");
        sb.append("awsSecretKey: " + getAwsSecretKey() + ", ");
        sb.append("awsAccountId: " + getAwsAccountId() + ", ");
        sb.append("awsAccountNickName: " + getAwsAccountNickName() + ", ");
        return sb.toString();
    }
}
